﻿using System;
using EP.Base.BaseService.Manager.Interface.Common;

namespace EP.Base.BaseService.Manager.Common
{
    public class ServiceSimplifyLog : IServiceSimplifyLog
    {
        private readonly ILog _log;
        public ServiceSimplifyLog(ILog log)
        {
            _log = log;
        }

        public void ExecSl(string summary, Action action, bool isThrow=false)
        {
            try
            {
                _log.Info(summary+"：开始！");
                action();
                _log.Info(summary + "：完成！");
            }
            catch (Exception ex)
            {
                _log.Error(summary+"：异常",ex);
                if (isThrow)
                    throw;
            }
        }
    }
}
